import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:wu_you/model/home/home_model.dart';
import 'package:wu_you/res/colors.dart';
import 'package:wu_you/utils/utils.dart';
import 'package:wu_you/widgets/html/flutter_html.dart';
import 'package:wu_you/utils/extension_utils.dart';

class HomeNoticeDialog extends StatefulWidget{
  final NoticeModel value;
  HomeNoticeDialog({Key key,this.value}):super(key: key);
  @override
  HomeNoticeDialogState createState() => HomeNoticeDialogState();
}
class HomeNoticeDialogState extends State<HomeNoticeDialog>{
  @override
  void initState() {
    super.initState();
  }
  @override
  Widget build(BuildContext context) {
    return Dialog(
        backgroundColor: Colors.transparent,
        child: Container(
          padding: EdgeInsets.all(0),
          child: Stack(
            children: [
              ClipRRect(
                borderRadius: BorderRadius.circular(20),
                child: Image.asset(
                  Utils.getImgPath("home_notice_dialog_bg"),
                  fit: BoxFit.fill,
                ),
              ),
              Positioned(
                  top: 5,
                  right: 0,
                  child: Image.asset(Utils.getImgPath("home_notice_cha"),width: 25,height: 25,color: Colors.black45,).addGesture(() {
                    Navigator.pop(context);
                  })
              ),
              Positioned(
                  top: 40,
                  left: 30,
                  right: 30,
                  child: Row(
                    mainAxisAlignment: MainAxisAlignment.center,
                    children: [
                      Image.asset(Utils.getImgPath("home_notice_tips"),width: 30,height: 30,),
                      SizedBox(width: 12,),
                      Expanded(child: Text("${widget.value.title}",
                        style: TextStyle(fontSize: 16,color: AppColors.primaryColor,fontWeight: FontWeight.bold,),maxLines: 2,overflow: TextOverflow.ellipsis,))
                    ],
                  )
              ),
              Positioned(
                  top: 100,
                  left: 30,
                  right: 30,
                  child: Container(
                    height: 230,
                    child: Html(data: "${widget.value.content}").addSingleScrollView(),
                  )
              ),
            ],
          ),
        )
    );
  }
}